package com.atguigu.controller;

import com.atguigu.service.OpenAiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("openAi")
public class Langchain4jOpenAiController {

    @Autowired
    OpenAiService openAiService;


    @GetMapping("chat")
    public String chat(String msg){
        return openAiService.chat(msg);
    }
    @PostMapping("stream")
    public Flux<String> stream(@RequestBody String msg){
        return openAiService.stream(msg);
    }

}
